using UnityEngine;
using UnityEngine.UI;

public class CoinConfig : MonoBehaviour
{
    [SerializeField] private CoinData coinData1;
    [SerializeField] private CoinData coinData05;

    [SerializeField] private InputField coinData1Text;
    [SerializeField] private InputField coinData05Text;

    void Start()
    {
        Refresh1();
        Refresh05();
    }

    public void OnInc1()
    { 
        coinData1.coinCount++;

        Refresh1();
    }

    public void OnDec1()
    {
        if (coinData1.coinCount == 0)
        {
            return;
        }

        coinData1.coinCount--;
        Refresh1();
    }

    private void Refresh1()
    {
        coinData1Text.text = coinData1.coinCount.ToString();
    }

    private void Refresh05()
    {
        coinData05Text.text = coinData05.coinCount.ToString();
    }

    public void OnInc05()
    {
        coinData05.coinCount++;
        Refresh05();
    }

    public void OnDec05()
    {
        if (coinData05.coinCount == 0)
        {
            return;
        }

        coinData05.coinCount--;
        Refresh05();
    }

    public void LoadSceondaryScene()
    {
        UnityEngine.SceneManagement.SceneManager.LoadScene(1);
    }
}
